<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="huoyun" uri="/huoyun"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>车源管理</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/theme/css/main.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/theme/css/style_userCenter.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/car/css/cars-cx.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/theme/js/jquery-1.6.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/car/js/jarea-by-chengxin.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/car/js/publish-car-tzh.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/theme/js/calendar/WdatePicker.js"></script>
<script type="text/javascript">
	function add_event(tr){
		tr.onmouseover = function(){
			tr.className += ' hover';
		};
		tr.onmouseout = function(){
			tr.className = tr.className.replace(' hover', '');
		};
	}

	function stripe(table) {
		var trs = table.getElementsByTagName("tr");
		for(var i=1; i<trs.length; i++){
			var tr = trs[i];
			tr.className = i%2 != 0? 'odd' : 'even';
			add_event(tr);
		}
	}

	window.onload = function(){
		var table = document.getElementById('my_published_cars_table');
		stripe(table);
		add_event(document.getElementById('submit_button'));
	}		
</script>


<style type="text/css">
	#submit_button {
		width: 100px;
		height: 40px;
		background-image: url("${pageContext.request.contextPath}/theme/images/button_normal.png");
		background-size: 100% 100%;
		border: none;
		cursor: pointer;
		font-family: 宋体;
		font-size: 18px;
		font-style: normal;
		color: #fff;
		font-weight: bold;
		
		background-image: url("${pageContext.request.contextPath}/theme/images/button_normal_ie.png")\9;
	}
	#submit_button:hover, #submit_button.hover {
		background-image: url("${pageContext.request.contextPath}/theme/images/button_hover.png");
		background-image: url("${pageContext.request.contextPath}/theme/images/button_hover_ie.png")\9;
	}
	#submit_button:active, #submit_button.active {
		background-image: url("${pageContext.request.contextPath}/theme/images/button_down.png");
		background-image: url("${pageContext.request.contextPath}/theme/images/button_down_ie.png")\9;
	}
</style>
</head>

<body>
	<div>
		<jsp:include page="../userAdmin/nav.jsp">
			<jsp:param value="nav_main" name="nav" />
		</jsp:include>
	</div>
	<div class="realCer">

		<!--主体部分-->
		<div class="realMain clearfix mt10">
			<!--左侧菜单-->
			<div class="realLeft" id="meunLeft">
				<jsp:include page="../userAdmin/leftMenu.jsp">
					<jsp:param value="con_nav_main" name="con_nav" />
					<jsp:param value="showMyPublishedCars" name="selectMenu"/>
				</jsp:include>
			</div>
			<!--中间-->
			<div class="realRight ml10">
				<!--中间-->
				<div class="realR_left">
					<div class="box" style="width: 805px;">
						<div class="tit">
							<strong>车源管理</strong>
						</div>
						<div class="con">
							<div id="my_published_cars_div" class="form_wrap clearfix">
								<form id="my_published_cars_form" method="post">
									<s:if test="myCarPubInfoItemList.size() != 0">
										<table id="my_published_cars_table">
											<tr style="background-color: silver;">
												<th>序号</th>
												<th>车牌号</th>
												<th>运载路线</th>
												<th>发车区间</th>
												<th>运载数量</th>
												<th>是否整车</th>
												<th>联系方式</th>
												<th>状态</th>
												<th>修改状态</th>
												<th>操作</th>
					        				</tr>
					        				
					        				<s:iterator value="myCarPubInfoItemList" id="myInfo" status="st">
					        					<tr>
					        						<td><s:property value="#st.index+1" /></td>
					        						<td><s:property value="#myInfo.carNumber" /></td>
					        						<td width="140px">
					        							<s:iterator value="#myInfo.carRouteList" id="route" status="st1">
					        								<s:property value="#st1.index+1"/>
					        								<huoyun:regionSelect provinceValue="${route.startProvince }" cityValue="${route.startCity }" townValue="${route.startTown }" type="view"/>
					        								&rarr;
					        								<huoyun:regionSelect provinceValue="${route.endProvince }" cityValue="${route.endCity }" townValue="${route.endTown }" type="view"/>
					        								<br>
					        							</s:iterator>
					        						</td>
					        						<td width="130px">
					        							始：<huoyun:dateFormat date="${myInfo.starttime }" dateFormat="yyyy-MM-dd HH:mm"/><br>
					        							终：<huoyun:dateFormat date="${myInfo.endtime }" dateFormat="yyyy-MM-dd HH:mm"/>
					        						</td>
					        						<td>
					        							<s:property value="#myInfo.loadAmount"/><huoyun:customSelect mode="measureType" value="${myInfo.unit }" type="view"/>
					        						</td>
					        						<td>
					        							<s:if test="#myInfo.type == 0">
					        								整车
					        							</s:if>
					        							<s:elseif test="#myInfo.type == 1">
					        								非整车
					        							</s:elseif>
					        						</td>
					        						<td>
					        							默认：<s:property value="#myInfo.defaultContact" /><br>
					        							紧急：<s:property value="#myInfo.urgentContact" />
					        						</td>
					        						
					        						<s:if test="#myInfo.status==0">
					        							<td>未上线</td>
					        							<td>
					        								<input type="button" value="上线" onclick="if(confirm('确定要让该条车源信息上线吗？（上线之后，货主即可搜索到该条车源信息）')){this.form.action='/huoyun/car/updateCarPubInfoStatus.action?status=1&carPubInfoId=${myInfo.id}'; this.form.submit();}">
					        							</td>
					        						</s:if>
					        						<s:elseif test="#myInfo.status==1">
					        							<td>在线</td>
					        							<td>
					        								<input type="button" value="下线" onclick="if(confirm('确定要让该条车源信息下线吗？（下线之后，货主将无法搜索到该条车源信息）')){this.form.action='/huoyun/car/updateCarPubInfoStatus.action?status=0&carPubInfoId=${myInfo.id}'; this.form.submit();}">
					        							</td>
					        						</s:elseif>
					        						<td>
					        							<a href="<%=request.getContextPath()%>/car/redirectEditCarInfo.action?id=${myInfo.id}">修改</a>
					        							<a href="/huoyun/car/deleteMyPublishedCar.action?carPubInfoId=${myInfo.id }" onclick="if(confirm('确定要删除该车源信息吗？'))return true; else return false;">删除</a>
					        						</td>
					        					</tr>
					        				</s:iterator>
										</table>
										<div style="width:100%; text-align:right;">
											<br>
											<font></font><a href="<s:url action="prePublishCar.action" namespace="/car"></s:url>">发布新车源</a>
											<br>
										</div>
									</s:if>
									<s:else>
										<div style="width:100%; text-align:center;">
											<p>
												<strong>
													<font size="5">您尚未发布任何车源信息!<a href="<s:url action="prePublishCar.action" namespace="/car"></s:url>">立即发布</a></font>
												</strong>
											</p>
										</div>
									</s:else>
								</form>
							</div>
						</div>
					</div>
				</div>
				<!-- 中间 -->
			</div>
			<!--中由-->
		</div>
	</div>
	<div>
		<jsp:include page="../footer.jsp"></jsp:include>
	</div>
</body>
</html>
